import scipy.stats
import numpy as np

# 1、求总体方差
s = 0.36
n = 18  # 样本数
alpha = 1 - 0.9

chi_1 = scipy.stats.chi2.isf(alpha / 2, df=(n - 1))
chi_2 = scipy.stats.chi2.isf(1 - alpha / 2, df=(n - 1))
lower_limit = (n - 1) * s / chi_1
upper_limit = (n - 1) * s / chi_2
print("({0},{1})".format(round(lower_limit, 5), round(upper_limit, 5)))
